
//初始化定时器3秒
var closeTime = 3;   
function closeTipsWindow(){   
	var timerD =  window.setTimeout('closeTipsWindow()',1000);   
	if(closeTime>0){   
		//$(".timeTag").html(closeTime);   
		closeTime --;   
	} else{   
		//fn_pop.messageHide($(".m-popA .close"));
		$(".m-popA").hide();
		fn_pop.maskHide();
		window.clearTimeout(timerD);
	}   
}   

//关闭提示框
function closeTipsPop(obj,cTime){
	closeTime = cTime;
	closeTime = 1;//强制1秒关闭
	//$($(obj)).css({"display":"block"});
	$(obj).show();
	fn_pop.maskShow();
	closeTipsWindow();
}

//弹层
var fn_pop = {
	maskShow : function(){
		$(".p-mask").css({"display":"block"});
	},
	maskHide : function(){
		$(".p-mask").css({"display":"none"});
	},
	popHide : function(obj_close){
		obj_close.parents(".m-popB").css({"display":"none"});
		fn_pop.maskHide();
	},
	messageHide : function(obj_close){
		obj_close.parents(".m-popA").css({"display":"none"});
		fn_pop.maskHide();
	},
	init : function(){
		$(".m-popB .hd .close").bind({
			click : function(){
				fn_pop.popHide($(this));
			}
		});
		
		$(".m-popA .hd .close").bind({
			click : function(){
				fn_pop.messageHide($(this));
			}
		});
	}
}

//气泡层
var fn_drum = {
	timer : null,
	maskShow : function(){
		$(".p-mask").css({"display":"block"});
	},
	maskHide : function(){
		$(".p-mask").css({"display":"none"});
	},
	show : function(obj){
		clearTimeout(fn_drum.timer);
		fn_drum.maskShow();
		$(obj).css({"display":"block"});
		$(obj).find(".close").click(function(){
			$(obj).css({"display":"none"});
			fn_drum.maskHide();
			clearTimeout(fn_drum.timer);
		});
		fn_drum.timer = setTimeout(function(){
			$(obj).css({"display":"none"});
			fn_drum.maskHide();
			clearTimeout(fn_drum.timer);
		},5000);
	}
}

$(function(){
	fn_pop.init();
})